<!---
    Title:      EPAR1.1 
    Author:     Bruce Frick
    Purpose:    index page
--->

<cfset BASE = CreateObject("component", "#session.rootDir#.cfc.base") />
<cfset mainQueries = CreateObject("component", "#session.rootDir#.cfc.queries") />
<cfinclude template="/code_lib/SCF_Employee.cfm">
<cfinclude template="/code_lib/SCF_HR.cfm">
<cfinclude template="/code_lib/SCF_REGEX.cfm">
<cfoutput>
<!---HTML header, css links, js links, and page title--->
#BASE.htmlTerminationHeader(
    "/jquery/ui-1.8.5/jquery-ui.min.js,../js/Step2-HRAcknowledgeRequest2.js", <!---JS links--->
    "/jquery/ui-1.8.5/themes/cupertino/jquery-ui.css", <!---CSS links--->
    "Step 2:  HR - Confirmation Request 2", <!---Page Title--->
    "Status" <!---Active Nav Link--->
)#
<!---HTML header, css links, js links, and page title--->


<cfif Session.bolAuth EQ True and (Session.strAuthType EQ Session.MANAGERS or Session.strAuthType EQ Session.IT or Session.strAuthType EQ Session.HR)>
    
    <cfset LOCALS = {} />

    <cfif isdefined("URL.TermReqID")>
        <cfset LOCALS.TermReqID = URL.TermReqID> 
        <cfset Session.TermReqID = LOCALS.TermReqID>
    <cfelseif isdefined("Form.TermReqID")>
        <cfset LOCALS.TermReqID = FORM.TermReqID> 
        <cfset Session.TermReqID = LOCALS.TermReqID>
    <cfelseif isdefined("Session.TermReqID")>
        <cfset LOCALS.TermReqID = Session.TermReqID>
    <cfelse>
        <cflocation url="Step2-HRAcknowledgeRequest1.cfm" addtoken="no">
    </cfif>
    
    <cfset QUERIES = {
        GetTermDetails = CreateObject("component", "#session.rootDir#.cfc.queries").funcGetTermDetails(LOCALS.TermReqID, 18),
        GetAllEmployees = CreateObject("component", "#session.rootDir#.cfc.queries").funcGetAllEmployees(),
        GetTermTypes = CreateObject("component", "#session.rootDir#.cfc.queries").funcGetPersonCodes('TT'),
        GetES = CreateObject("component", "#session.rootDir#.cfc.queries").funcGetPersonCodes('ES'),
        GetRC = CreateObject("component", "#session.rootDir#.cfc.queries").funcGetReasonCodes('ES') 
    } />

    <cfquery name="QUERIES.GetEmpStatus" dbtype="query">
        Select * 
        From QUERIES.GetES
        Where PersonCodeIDNo in (-10133, -10132)
    </cfquery>    
    
    <cfquery name="QUERIES.GetESReasonCodes" dbtype="query">
        Select * From QUERIES.GetRC
        Where ReasonCodeIDNo not in (3,5,6,56)
    </cfquery>
    
    <h1 class="title">Step 2:  HR - Termination Acknowledge</h1>
    <div class="entry">    
         Welcome, #Session.arrEmpInfo.FirstName# #Session.arrEmpInfo.LastName#.  
         In this step, we'll capture information necessary to initiate the 
         request for termination of an employee: 
         <br /><br />
                         
        <cfform name="frmStep2" method="post" action="api.cfm?api=step2Termination_acknowledgement_update">
            
			<table width = 100%>
			    <tr>
			        <td width="27%">Submitted By:</td>
			        <td>
			            #SCF_EMPLOYEE_GetEmployee(QUERIES.GetTermDetails.ActionByID).FullName#
			            <cfinput type="hidden" name="ManagerName" 
                            value="#SCF_EMPLOYEE_GetEmployee(QUERIES.GetTermDetails.ActionByID).FullName#"/>
			        </td>
			    </tr>
			    <tr>
			        <td>Submitted Date/Time:</td>
			        <td>
			            #dateformat(QUERIES.GetTermDetails.ActTimeStamp,'mm/dd/yyyy') & ' ' & timeformat(QUERIES.GetTermDetails.ActTimeStamp,'HH:MM:ss TT')#
			            <cfinput type="hidden" name="DateSubmitted" 
                            value="#dateformat(QUERIES.GetTermDetails.ActTimeStamp,'mm/dd/yyyy') & ' ' & timeformat(QUERIES.GetTermDetails.ActTimeStamp,'HH:MM:ss TT')#"/>
			        </td>
			    </tr>
			    <tr>
			        <td valign="top">Comments:</td>
			        <td>
			            #QUERIES.GetTermDetails.Notes#
			            <cfinput type="hidden" name="ManagerComments" value="#QUERIES.GetTermDetails.Notes#"/>
			        </td>
			    </tr>
			    <tr>
			        <td colspan=2><HR /></td>
			    </tr>
			    <tr>
			        <td >Employee:</td>
			        <td>
			            #SCF_EMPLOYEE_GetEmployee(QUERIES.GetTermDetails.RosettaID).FullName#
			        </td>
			    </tr>
                <tr>
                    <td>Supervisor:</td>
                    <td>
                        <cfset Supervisor = SCF_HR_WhosTheBoss(QUERIES.GetTermDetails.RosettaID)/>
                        #SCF_EMPLOYEE_GetEmployee( Supervisor ).FullName#
                    </td>
                </tr>
                <tr>
                    <td >Division:</td>
                    <td>
                        <cfset EmployeeDivDep = SCF_HR_GetJobPositions(QUERIES.GetTermDetails.RosettaID, 0, 1)/>
                        #EmployeeDivDep[1].Department.OwnerEntity.DisplayName#
                    </td>
                </tr>
                <tr>
                    <td >Department:</td>
                    <td>
                        #EmployeeDivDep[1].Department.DisplayName#
                    </td>
                </tr>
			    <tr>
			        <td>Termination Type:</td>
			        <td>                        
			            <cfselect name="TermTypeID" query="QUERIES.GetTermTypes" 
                            tabindex="20" value="PersonCodeIDNo" 
                            display="PersonCode" selected="0"/>
			        </td>
			    </tr>
			    <tr>
			        <td>Employee Status:</td>
			        <td>                        
			            <cfselect name="EmpStatusIDNo" query="QUERIES.GetEmpStatus" tabindex="30" value="PersonCodeIDNo" display="PersonCode" selected="#QUERIES.GetTermDetails.EmpStatusIDNo#"/>
			        </td>
			    </tr>
			    <tr>
			        <td nowrap="nowrap">Employment Status Reason:</td>
			        <td>                        
			            <cfselect name="EmpStatusReasonCode" query="QUERIES.GetESReasonCodes" tabindex="40" value="ReasonCodeIDNo" display="ReasonCode" selected="#QUERIES.GetTermDetails.EmpStatusReasonCode#"/>
			        </td>
			    </tr>
			    <tr>
			        <td>&nbsp;</td>
			        <td>
			            <cfinput type="checkbox" name="RehireElig" tabindex="45"  checked="yes"> Rehire Eligible
			        </td>
			    </tr>
			    <tr>
			        <td valign="top" title="AD account, home folder archive, email archive.">
                        Effective Termination Date*: <BR />
                    </td>
			        <td>
                        <div id="DateOfTermination_datepicker" ></div>
                        <cfif QUERIES.GetTermDetails.TermDate EQ "" OR QUERIES.GetTermDetails.TermDate EQ 'NULL'>
                            <cfset td = '#Now()#' />
                        <cfelse>
                            <cfset td = QUERIES.GetTermDetails.TermDate />
                        </cfif>
                        <cfinput type="hidden" name="TermDate" 
                            error_message="Please provide the Termination Date."
                            value="#dateformat(td,'mm/dd/yyyy')#" >
			        </td>
			    </tr>
                <tr>
                    <td valign="top" title="HR disable, HR Kronos username changed.">
                        HR Termination Date*: <BR />
                    </td>
                    <td>
                        <div id="SysDateOfTermination_datepicker"></div>
                        <cfif QUERIES.GetTermDetails.SysTermDate EQ "" OR QUERIES.GetTermDetails.SysTermDate EQ 'NULL'>
                            <cfset std = '#Now()#' />
                        <Cfelse>
                            <cfset std = QUERIES.GetTermDetails.SysTermDate />
                        </cfif>
                        <cfinput type="hidden" name="SysTermDate" 
                            error_message="Please provide the Termination Date."
                            value="#dateformat(std,'mm/dd/yyyy')#" >
                    </td>
                </tr>
                <tr>
                    <td valign="top">Comments</td>
                    <td>
                        <cftextarea rows="2" tabindex="70" name="Comments" style="width:90%" value="" />
                    </td>
                </tr>
			    <tr>
			        <td>&nbsp;</td>
			    </tr>
			    <tr>
			        <td colspan="5" align="right">
                        <cfinput type="hidden" name="TermReqID" value="#LOCALS.TermReqID#" />
                        <cfinput type="hidden" name="RosettaID" value="#QUERIES.GetTermDetails.RosettaID#" />
                        <cfinput type="button" name="Reject" value="Reject" tabindex="80">
			            <cfinput type="button" name="Submit" value="Next >>" tabindex="80">
			        </td>
			    </tr>
			</table>
            
        </cfform>
    
    </div>

<cfelse>
    <cfinclude template="../denied.cfm">
</cfif>


<!---HTML footer, closes html and body tags.  Any footer info goes here--->
#BASE.htmlTerminationFooter()#
<!---HTML footer, closes html and body tags.  Any footer info goes here--->
</cfoutput>